﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:helpers="clr-namespace:UColor.Core.Helpers;assembly=UColor.Core"
    xmlns:demoparts="clr-namespace:UColor.Core.DemoParts;assembly=UColor.Core">

    <helpers:SelectConverter x:Key="BackButtonPaddingConverter">
        <helpers:SelectState Key="False" Value="{helpers:BrushValue S=#FF3D3D3D}" />
        <helpers:SelectState Key="True" Value="{helpers:BrushValue S=#FFF7941E}" />
    </helpers:SelectConverter>
    <helpers:SelectConverter x:Key="BackButtonContentOpacityConverter">
        <helpers:SelectState Key="Normal" Value="{helpers:DoubleValue S=1}" />
        <helpers:SelectState Key="MouseOver" Value="{helpers:DoubleValue S=1}" />
        <helpers:SelectState Key="Pressed" Value="{helpers:DoubleValue S=0.35}" />
        <helpers:SelectState Key="Disabled" Value="{helpers:DoubleValue S=0.25}" />
    </helpers:SelectConverter>
    <Style x:Key="BackButton" TargetType="helpers:ButtonExt">
        <Setter Property="Width" Value="41" />
        <Setter Property="Height" Value="47" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="helpers:ButtonExt">
                    <Grid Background="{helpers:SelectBinding Binding={Binding IsMouseOver, RelativeSource={RelativeSource TemplatedParent}}, Converter={StaticResource BackButtonPaddingConverter}}">
                        <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                Opacity="{helpers:SelectBinding Binding={Binding CommonState, RelativeSource={RelativeSource TemplatedParent}}, Converter={StaticResource BackButtonContentOpacityConverter}}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>